home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_force_heal.cog < prev    next >
Text File  |  1998-02-25  |  3KB  |  139 lines

  1. # Jedi Knight Cog Script
  2. #
  3. # FORCE_HEALING.COG
  4. #
  5. # FORCEPOWER Script - Healing
  6. #  Light Side Power
  7. #  Bin 25
  8. #
  9. # [YB]
  10. #
  11. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  12.  
  13.  
  14. symbols
  15.  
  16. thing       player                           local
  17.  
  18. flex        cost=200.0                       local
  19. int         rank                             local
  20. flex        mana                             local
  21.  
  22. sound       healingSound=ForceHealing01.WAV  local
  23. int         soundChannel=-1                  local
  24.  
  25. template    sphere_tpl=+force_heal           local
  26. int         sphere=-1                        local
  27.  
  28. vector      position                         local
  29.  
  30. int         inbubble=0                       local
  31.  
  32. message     startup
  33. message     activated
  34. message     newplayer
  35. message     killed
  36. message     selected
  37. message     enterbubble
  38. message     exitbubble
  39.  
  40. end
  41.  
  42. # ========================================================================================
  43.  
  44. code
  45.  
  46. startup:
  47.    player = GetLocalPlayerThing();
  48.    inbubble = 0;
  49.    call stop_power;
  50.  
  51.    Return;
  52.  
  53. # ........................................................................................
  54.  
  55. activated:
  56.    if(inbubble) Return;
  57.  
  58.    if((!IsInvActivated(player, 25)) && (GetThingHealth(player) != 100) && (GetThingHealth(player) > 0))
  59.    {
  60.       mana = GetInv(player, 14);
  61.       if(mana >= cost || GetInv(player, 14) >= GetInv(player, 69))
  62.       {
  63.          if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
  64.  
  65.          // Send a "force disturbance"...
  66.          if(!IsMulti())
  67.             SendMessageExRadius(GetThingPos(player), cost, 0x4, splash, 25, 0, 0, 0);
  68.  
  69.          SetInvActivated(player, 25, 1);
  70.  
  71.          PlayMode(player, 24);
  72.  
  73.          soundChannel = PlaySoundThing(healingSound, player, 1.0, -1, -1, 0x80);
  74.  
  75.          rank = GetInv(player, 25);
  76.          SetBinWait(player, 25, 1.2);
  77.  
  78.          // Create the sphere
  79.          position = VectorAdd(GetThingPos(player), '0.0 0.0 0.01');
  80.          sphere = CreateThingAtPosNR(sphere_tpl, GetThingSector(player), position, '0.0 0.0 0.0');
  81.  
  82.          AttachThingToThingEx(sphere, player, 0x8);
  83.          Sleep(0.6);
  84.  
  85.          SetParticleGrowthSpeed(sphere, -3.0);
  86.  
  87.          // We don't want any strange things like a dead player with health in the HUD
  88.          if(GetThingHealth(player) > 0) HealThing(player, 20 * rank);
  89.  
  90.          Sleep(0.40);
  91.  
  92.          DestroyThing(sphere);
  93.          call stop_power;
  94.       }
  95.    }
  96.  
  97.    Return;
  98.  
  99. # ........................................................................................
  100.  
  101. selected:
  102.    jkPrintUNIString(player, 25);
  103.    Return;
  104.  
  105. # ........................................................................................
  106.  
  107. killed:
  108.    if(GetSenderRef() != player) Return;
  109.  
  110. newplayer:
  111.    call stop_power;
  112.  
  113.    Return;
  114.  
  115. # ........................................................................................
  116.  
  117. enterbubble:
  118.    inbubble = 1;
  119.    call stop_power;
  120.    Return;
  121.  
  122. # ........................................................................................
  123.  
  124. exitbubble:
  125.    inbubble = 0;
  126.    Return;
  127.  
  128. # ........................................................................................
  129.  
  130. stop_power:
  131.    SetInvActivated(player, 25, 0);
  132.  
  133.    Return;
  134.  
  135. end
  136.  
  137.  
  138.  
  139.